import { IsString, IsInt, IsOptional, IsDateString, ValidateNested, IsArray } from 'class-validator';
import { Type } from 'class-transformer';

class SchoolDto {
  @IsInt()
  level: number;

  @IsInt()
  schoolId: number;

  @IsInt()
  graduateDate: number;

  @IsString()
  className: string;
}

export class InfoDto {
  @IsString()
  name: string;

  @IsInt()
  gender: number;

  @IsDateString()
  birthday: string;

  @IsInt()
  degree: number;

  @IsInt()
  identityType: number;

  @IsString()
  identityCode: string;

  @IsString()
  company: string;

  @IsOptional()
  @IsString()
  industryCode?: string;

  @IsString()
  workPost: string;

  @IsInt()
  industryId: number;

  @IsArray()
  @ValidateNested({ each: true })
  @Type(() => SchoolDto)
  schools: SchoolDto[];
}
